<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateItemAttachmentTable extends Migration
{

    protected $tableName = 'item_attachment';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->tableName, function (Blueprint $table) {
            $table->string('item_type')->comment('条目类型，知识，课程等');
            $table->string('item_id')->comment('条目ID');
            $table->string('attachment_id')->comment('附件ID');
            $table->timestamps();

            $table->softDeletes();
        });
        DB::statement("ALTER TABLE `$this->tableName` comment '知识点标签关系'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->tableName);
    }
}
